<?php



namespace App\Services\Member\Models;

use App\Services\Business\Models\Group;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class UserJoinGroupRecord extends Model
{
    use HasFactory;

    protected $table = 'user_join_group_records';

    protected $fillable = [
        'user_id',  'charge', 'started_at', 'expired_at','joinable_id','joinable_type','company_id'
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function group()
    {
        return $this->belongsTo(Group::class, 'chat_id');
    }
    public function joinable()
    {
        return $this->morphTo();
    }
}
